//
//  KCaseCommandDTO.m
//  KutulusLaw
//
//  Created by Mahmood1 on 12/10/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "KCaseCommandDTO.h"

@implementation KCaseCommandDTO
@synthesize dateType = _dateType, dateTypeText = _dateTypeText;

- (id)initWithSessionID:(NSString *)sessionID {
    self = [super initWithSessionID:sessionID];
	
    if (self) {
		self.action = kAPI_CASES_ACTION;
    }
	
    return self;
}

- (void)setDateType:(NSInteger)dateType {
	if (dateType > eDateTypeByUpdate) {
		return;
	}
	
	_dateType = dateType;
	
	switch (dateType) {
		case eDateTypeByPost:
			_dateTypeText = kVALUE_DATE_TYPE_BY_POST;
			break;
		case eDateTypeByUpdate:	
			_dateTypeText = kVALUE_DATE_TYPE_BY_UPDATE;
		default:
			break;
	}
}

- (void)setFileType:(NSInteger)fileType {
	if (fileType > eCaseFileTypeVideoFile) {
		return;
	}
	
	_fileType = fileType;
	
	switch (self.fileType) {
		case eCaseFileTypeNone:
			self.fileTypeText = kVALUE_FILE_TYPE_NONE;
			break;
		case eCaseFileTypeNoFile:
			self.fileTypeText = kVALUE_FILE_TYPE_NO_FILE;
			break;
		case eCaseFileTypeAny:
			self.fileTypeText = kVALUE_FILE_TYPE_ANY;
			break;
		case eCaseFileTypePDFFile:
			self.fileTypeText = kVALUE_FILE_TYPE_PDF_FILE;
			break;
		case eCaseFileTypeVideoFile:
			self.fileTypeText = kVALUE_FILE_TYPE_VIDEO_FILE;
			break;
		default:
			
			self.fileTypeText = kVALUE_FILE_TYPE_ANY;
			break;
	}
}

- (NSMutableDictionary *)dictionary {
	NSMutableDictionary *dic = [super dictionary];
	
	if (dic) {
		[dic setValue:self.dateTypeText forKey:kKEY_DATE_TYPE];
	}
	
	return dic;
}

- (void)reset {
	[super reset];
	
	[self setDateType:eDateTypeByPost];
	[self setFileType:eCaseFileTypeNone];
}
@end
